abp(net core)+easyui+efcore实现仓储管理系统

您所在的位置:网站首页 datagrid getchanges abp(net core)+easyui+efcore实现仓储管理系统

abp(net core)+easyui+efcore实现仓储管理系统

2023-08-10 18:38| 来源: 网络整理| 查看: 265

    在上面文章abp(net core)+easyui+efcore实现仓储管理系统——入库管理之十(四十六) 的学习之后,我们已经实现了入库单的基本功能,增加,删除,修改。接下来,我们实现添加库位的功能。

 

十五、入库单添加库位信息

   入库单的每一条明细数据,会对应一个或多个库位。这就要求能够对某一行的数据进行子表嵌套。在这里通过采用easyui的datagrid-detailview.js插件创建子表格,大致的效果图如下所示:

 abp(net core)+easyui+efcore实现仓储管理系统——入库管理之十一(四十七)_efcore

 

在Visual Studio 2017的“解决方案资源管理器”中,找到“ABP.TPLMS.Web.Mvc”项目的“Views/InStock”文件夹,然后鼠标左键双击打开“Index.cshtml”文件。在“@section scripts{”节中添加如下代码。

      2. 在Visual Studio 2017的“解决方案资源管理器”中,找到表示层“ABP.TPLMS.Web.Mvc”项目中的wwwroot\view-resources\InStock目录。

       3. 在InStock目录中找到Index.js文件。在此文件的头部我们要定义两个变量mainIndex与editIndex,用来定位当前我们选中了哪一行。

var editIndex = undefined;var mainIndex = undefined;

       4. 我们在此文件中的showDetail(no)方法中找到datagrid组件,并修改此组件的onClickRow事件中的相关代码。

onClickRow

rowIndex, rowData

当用户点击一行时触发,参数包括:rowIndex:被点击行的索引,从 0 开始rowData:被点击行对应的记录

 

 function ShowDetail(no) {    var lastIndex;     $("#dgINOD").datagrid({         url: "/InStock/GetDetail?no=" + no,         title: "入库单明细",         pagination: false,              fit: true,         fitColumns: false,         loadMsg: "正在加载入库单明细信息...",         toolbar: [             { text: '添加明细', iconCls: 'icon-add', handler: function () { ShowCargoInfo(); } },             { text: '添加库位', iconCls: 'icon-edit', handler: function () { SubGridAddRow(); } },             { text: '删除', iconCls: 'icon-remove', handler: function () { deviceInfoDeleteClick(); } },            '-'         ],         nowarp: false,         border: false,         idField: "Id",         sortName: "Id",         sortOrder: "asc",         singleSelect: true,         iconCls: 'icon-edit',               columns: [[             { title: "编号", field: "SeqNo", width: 50, sortable: true },             { title: "入库单号", field: "InStockNo", width: 100, sortable: true },             { title: "HSCode", field: "HSCode", width: 80, sortable: false },             { title: "货物代码", field: "CargoCode", width: 100, sortable: true },             { title: "货物名称", field: "CargoName", width: 160, sortable: false },             { title: "规格型号", field: "Spcf", width: 80, sortable: false },             {                 title: "数量", field: "Qty", width: 100, align: 'center', editor: {                     type: 'numberbox', options: {                         required: true, min: 0, precision: 4                     }                 }             },             {                 title: "长", field: "Length", width: 70, align: 'center', editor: {                     type: 'numberbox', options: {                         required: true, min: 0, precision: 2                     }                 }             },             {                 title: "宽", field: "Width", width: 70, align: 'center', editor: {                     type: 'numberbox', options: {                         required: true, min: 0, precision: 2                     }                 }             },             {                 title: "高", field: "Height", width: 70, align: 'center', editor: {                     type: 'numberbox', options: {                         required: true, min: 0, precision: 2                     }                 }             },             { title: "产销国", field: "Country", width: 70, align: 'center' },             {                 title: "单价", field: "Price", width: 100, align: 'center', editor: {                     type: 'numberbox', options: {                         required: true, min: 0, precision: 2                     }                 }             },                    {                 title: "总价", field: "TotalAmt", width: 100, align: 'center', editor: {                     type: 'numberbox', options: {                         required: true, min: 0, precision: 2                     }                 }             },             { title: "包装", field: "Package", width: 70, align: 'center' },             { title: "计量单位", field: "Unit", width: 70, align: 'center' },             {                 title: "总体积", field: "Vol", width: 70, align: 'center', editor: {                     type: 'numberbox', options: {                         required: true, min: 0, precision: 4                     }                 }             },            { title: "品牌", field: "Brand", width: 70, align: 'center' }         ]],         view: detailview,         detailFormatter: function (index, row) {            return '';         },         onExpandRow: function (index, row) {            var ddv = $('#dgINODItem-' + index);             ddv.datagrid({                 url: '/InStock/GetLocs?Id=' + row.Id,                 fitColumns: false,                 singleSelect: true,                 rownumbers: true,                 loadMsg: '',                 height: 'auto',                 columns: [[                     { field: 'SeqNo', title: '序号', width: 50 },                     {                         field: 'Qty', title: '数量', width: 120, editor: {                             type: 'numberbox', options: {                                 required: true, min: 0, precision: 2                             }                         }                     },                     {                         field: 'Loc', title: '库位', width: 150, editor: {                             type: 'text', options: {                                 required: true                             }                         }                     },                     { field: 'CreationTime', title: '创建时间', hidden: 'true' },                     { field: 'Id', title: 'Id', width: 50, hidden: 'true' },                     { field: 'InStockOrderDetailId', title: 'InodId', width: 50, hidden: 'true' }                 ]],                 onResize: function () {                     $('#dgINOD').datagrid('fixDetailRowHeight', index);                 },                 onLoadSuccess: function () {                     setTimeout(function () {                         $('#dgINOD').datagrid('fixDetailRowHeight', index);                     }, 0);                     editIndex = undefined;//主网格换行                },                 onAfterEdit: function (rowIndex, rowData, changes) {                     editIndex = undefined;                 },                 onClickRow: function (index1, row1) {                    if (editIndex != index1) {                        if (endEditing(ddv)) {                             ddv.datagrid('selectRow', index1).datagrid('beginEdit', index1);                             editIndex = index1;                         }                        else { ddv.datagrid('selectRow', editIndex); }                     }                 }             });             $('#dgINOD').datagrid('fixDetailRowHeight', index);         },          onClickRow: function (index, rowData) {            if (mainIndex!=undefined) {                 $('#dgINOD').datagrid('collapseRow', mainIndex);             }                        if (lastIndex != index) {                 $('#dgINOD').datagrid('endEdit', lastIndex);                 editrow(index);             }             lastIndex = index;             mainIndex = index;         },                onBeginEdit: function (rowIndex, rowData) {               setEditing(rowIndex);         }     }); }

5. 除了要修改上面的函数之外,我们还需要添加一些函数方法。下面就给出Index.js的全部代码:

//-----------------------系统管理-->入库单管理-----------------------//var editIndex = undefined;var mainIndex = undefined;//刷新数据function initable() {     $("#dgINSO").datagrid({         url: "/InStock/List",         title: "入库单管理",         pagination: true,         pageSize: 10,         pageList: [10, 20, 30],         fit: true,         fitColumns: false,         loadMsg: "正在加载入库单信息...",         nowarp: false,         border: false,         idField: "Id",         sortName: "Id",         sortOrder: "asc",         frozenColumns: [[//冻结列             { field: "ck", checkbox: true, align: "left", width: 50 }                    ]],         columns: [[             { title: "编号", field: "Id", width: 50, sortable: true },             { title: "入库单号", field: "No", width: 100, sortable: true },                        {title: "状态", field: "Status", width: 50            },             { title: '到货日期', field: 'ReceiveTime',  width: 100, align: 'center' },             { title: "货主", field: "OwnerCode", width: 150, sortable: true },             { title: "预计到货时间", field: "PreDeliveryTime", width: 100, sortable: false },             { title: '客户', field: 'CustomerName', width: 120, align: 'center' },             { title: '收货人',field: 'Oper', width: 100, align: 'center' },             { title: '审核人',field: 'Checker', width: 120, align: 'center' },             { title: '件数', field: 'PackageQty', width: 100, align: 'center' },             { title: '创建时间', field: 'CreationTime', width: 100, align: 'center' }         ]]     });  }//显示送货单数据function ShowCargo() {     abp.log.warn('货物信息列表日志...');     $("#dgCargo").datagrid({         url: "/Cargo/List",         title: "货物管理管理",         pagination: true,         pageSize: 10,         pageList: [10, 20, 30],         fit: true,         fitColumns: false,         loadMsg: "正在加载货物信息...",         nowarp: false,         border: false,         idField: "Id",         sortName: "Id",         sortOrder: "asc",         frozenColumns: [[//冻结列             { field: "ck", checkbox: true, align: "left", width: 50 }         ]],         columns: [[             { title: "编号", field: "Id", width: 50, sortable: true },             { title: "供应商", field: "SupplierId", width: 80, sortable: true },             { title: "HSCode", field: "HSCode", width: 100, sortable: true },             { title: "货物代码", field: "CargoCode", width: 100, sortable: true },             { title: "货物名称", field: "CargoName", width: 80, sortable: false },             { title: "规格型号", field: "Spcf", width: 100, sortable: false },             { title: "产销国", field: "Country", width: 80, sortable: false },             { title: "计量单位", field: "Unit", width: 100, sortable: false },             { title: "包装", field: "Package", width: 100, sortable: false },             { title: "单价", field: "Price", width: 100, sortable: false },             { title: "币制", field: "Curr", width: 80, sortable: false },             {                 title: "长宽高", field: "Length", width: 100, sortable: false, formatter: function (value, row, index) {                    return row.Length + '*' + row.Width + '*' + row.Height;                 }             },             { title: "体积", field: "Vol", width: 80, sortable: false },             { title: "备注", field: "Remark", width: 80, sortable: false },             { title: '创建时间', field: 'CreationTime', width: 100, align: 'center' }         ]]     });     abp.log.warn('3货物信息列表日志...'); }  function ShowCargoInfo() {       $("#divImportCargo").dialog({             closed: false,             title: "选择货物信息",             modal: true,             width: 820,             height: 550,             collapsible: true,             minimizable: true,             maximizable: true,             resizable: true         });        ShowCargo();        $("#dgCargo").datagrid("clearChecked");        $("#dgCargo").datagrid("clearSelections"); }  function reloaded() {   //reload     $("#reload").click(function () {        //        $('#dgINSO').datagrid('reload');     });}  //修改点击按钮事件function updInSOInfo() {       $("#edit").click(function () {               //判断选择的中         var row = $("#dgINSO").datagrid('getSelected');                 if (row) {                      $.messager.confirm('编辑', '您想要编辑吗?', function (r) {                if (r) {                                      //打开对话框编辑                     $("#divAddUpdINO").dialog({                         closed: false,                         title: "修改入库单",                         modal: true,                         width: 820,                         height: 550,                         collapsible: true,                         minimizable: true,                         maximizable: true,                         resizable: true,                     });                         //先绑定                                       showINO(row);                     defaultTab();                     ShowDetail(row.No);                 }                            });             SetEnabled(row.Status);         } else {             $.messager.alert('提示', ' 请选择要编辑的行!', 'warning');         }     });    }//删除function deleteInSO() {     $("#del").click(function () {        var rows = $("#dgINSO").datagrid("getSelections");        if (rows.length > 0) {             $.messager.confirm("提示", "确定要删除吗?", function (res) {                if (res) {                    var codes = []; //重要不是{}                     for (var i = 0; i = 1 && month = 0 && strDate 


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3